### Project 32 Make A Tone **1.Overview** In the above projects, we’ve introduced passive buzzer module, TEMT6000 ambient light sensor, soil humidity sensor and other sensors . We now combine those sensor modules to make interactive projects. In this project, you will learn how to make a buzzer play different tones based on the measured analog value of both ambient light and microphone sound. **2.Components Required** - Micro:bit main board \*1 - USB Cable \*1 - Keyestudio Edge Connector IO Breakout Board for Micro:bit - Keyestudio Passive Buzzer Module for micro:bit \*1 - Keyestudio TEMT6000 Light Module for micro:bit \*1 - Keyestudio Soil Humidity Module for micro:bit \*1 - Alligator Clip Cable \*9 **3.Connection Diagram** Attach the main board to Keyestudio Edge Connector IO Breakout Board for Micro:bit; Connect the three keyestudio micro bit honeycomb sensors/modules to the shield with Alligator clip cables; For passive buzzer module, ring S to P0, V to 3V, and G to GND. For TEMT6000 ambient light module, ring S to P1, V to 3V, and G to GND. For soil humidity module, ring S to P2, V to 3V, and G to GND. ![](media/image-20260128171337978.png) **4.Coding** So now let's move to coding. Below are some steps to follow. Open the [https://makecode.micro:bit.org/\#editor](https://makecode.microbit.org/#editor) to write your code. Microsoft MakeCode is actually a platform that allows us to code for a micro:bit, and also provides an interactive simulator where we can debug and run our code, and will be able to see what to expect out right there on the site. Go to MakeCode and choose **My Projects** and click on **New Projects**. If you want to see the codes behind, then you can click on JavaScript and it will display JavaScript code there in IDE. ![](media/image-20260128171750159.png) **5.The following test code is for your reference** ![](media/image-20260128171810546.png) **6.Test Results** Wire according to connection diagram and upload the test code to the main board. Open CoolTerm →click Options →click SerialPort to set COM port and baud rate(set it to 115200)→click OK→click Connect. CoolTerm serial port monitor displays the light intensity analog values read by the TEMT6000 ambient light sensor (P1) to render the buzzer to make a sound. If the simulated values of ambient light and soil moisture are both less than or equal to 100, the buzzer will not sound;If the simulated value of ambient light is greater than 100 and the simulated value of soil moisture is less than or equal to 100, the buzzer will play bass B;When the simulated value of ambient light is less than or equal to 100, and the simulated value of soil moisture is greater than 100, the buzzer will play tenor D;When the simulated value of ambient light and the simulated value of soil moisture are both greater than 100, the buzzer utters the high tone E. ![](media/image-20260128172132284.png)